<template>
    <div>
        <van-nav-bar title="商品详情" left-text="返回" left-arrow @click-left="onClickLeft" />
        <!-- 轮播 -->
        <swipe :images="detailinfo.pics"></swipe>
        <!-- 富文本 -->
        <div v-html="detailinfo.goods_introduce"></div>
        <van-action-bar>
            <van-action-bar-icon icon="chat-o" text="客服" dot />
            <van-action-bar-icon icon="cart-o" text="购物车" badge="5" />
            <van-action-bar-icon icon="shop-o" text="店铺" badge="12" />
            <van-action-bar-button type="warning" text="加入购物车" />
            <van-action-bar-button type="danger" text="立即购买" />
        </van-action-bar>
    </div>
</template>

<script setup>
import { ref } from 'vue'
//引入路由
import { useRouter, useRoute } from 'vue-router'
//实例化
const router = useRouter()
const route = useRoute()
//引入轮播
import swipe from '../components/swipe.vue'
import axios from '../request'
//返回上一级
const onClickLeft = () => router.go(-1)
//详情
const detailinfo = ref({})
const detailinfoinit = () => {
    axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/detail', {
        params: {
            goods_id: route.query.id
        },
    }).then((res) => {
        detailinfo.value = res
    })
}
detailinfoinit()
</script>

<style lang="scss" scoped></style>